
<template>
  <div>
    <!-- 控制扫码组件的显示与隐藏 -->
    <div>扫码结果： {{ scanResult }}</div>
    <QRCodeScanner v-if="showQRCode" @on-success="handleScanSuccess" />
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import QRCodeScanner from "@/apps/client/views/QRCodeScanner.vue"; // 引入子组件

const showQRCode = ref(true); // 控制扫码组件是否显示
const scanResult = ref(null);
// 处理扫码成功的结果
function handleScanSuccess(text: string) {
  alert(`扫码结果：${text}`);
  scanResult.value = text
  showQRCode.value = false;  // 隐藏扫码组件
}
</script>
